function [fgh] = Function_Generate_gh_Sequence(Mode, n_ID, n_s)
	% f_gh Generate the f_gf sequence (indexed by slot number n_s=0,1,...,19) needed for determination of Group hopping
 	% Inputs:      n_ID                     - (virtual) cell ID
  	% Outputs:     fgh                      - seq. of base seq. numbers
	% Spec:        3GPP TS 36.211 section 5.5.1.3 v13.0.0
    
    switch Mode
        case 'pusch'
            c_init = floor(n_ID/30);
            c = phy_goldseq_gen(8*20, c_init);
                
            fgh = zeros(1,2); %initialization
            for slot = 0:1
                for i = 0:7
                    fgh(slot+1) = fgh(slot+1) + c(8*(n_s+slot)+i+1) * 2^i;
                end
            end
                
            fgh = mod(fgh,30);  
            
        case 'pssch_D2D'
            %same as pusch, using nPSSCHss slot index instead of n_s
            c_init = floor(n_ID/30);
            c = phy_goldseq_gen(8*20, c_init);
                
            fgh = zeros(1,2); %initialization
        	for slot = 0:1
                for i = 0:7
                    fgh(slot+1) = fgh(slot+1) + c(8*(n_s+slot)+i+1) * 2^i;
                end
            end
                
            fgh = mod(fgh,30);
            
        case 'pssch_V2X'
            % same as pusch, using nPSSCHss slot index instead of n_s
            c_init = floor(n_ID/30);
            c = Function_Phy_Goldseq_Gen(8*20, c_init);
                
            fgh = zeros(1,2); %initialization
            for slot = 0:1
                for i = 0:7
                    fgh(slot+1) = fgh(slot+1) + c(8*(n_s+slot)+i+1) * 2^i;                        
                end
            end
                
            fgh = mod(fgh,30);
    end